home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 2 / AACD 2.iso / AACD / Magazine / GraphicsCards / StormMesa / src / quads.c < prev    next >
C/C++ Source or Header  |  1999-02-04  |  2KB  |  102 lines

  1. /* $Id: quads.c,v 3.2 1998/05/31 23:50:36 brianp Exp $ */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  3.0
  6.  * Copyright (C) 1995-1998  Brian Paul
  7.  *
  8.  * This library is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU Library General Public
  10.  * License as published by the Free Software Foundation; either
  11.  * version 2 of the License, or (at your option) any later version.
  12.  *
  13.  * This library is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  * Library General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU Library General Public
  19.  * License along with this library; if not, write to the Free
  20.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23.  
  24. /*
  25.  * $Log: quads.c,v $
  26.  * Revision 3.2  1998/05/31 23:50:36  brianp
  27.  * cleaned up a few Solaris compiler warnings
  28.  *
  29.  * Revision 3.1  1998/03/27 04:17:31  brianp
  30.  * fixed G++ warnings
  31.  *
  32.  * Revision 3.0  1998/01/31 21:02:06  brianp
  33.  * initial rev
  34.  *
  35.  */
  36.  
  37.  
  38. /*
  39.  * Quadrilateral rendering functions.
  40.  */
  41.  
  42.  
  43. #ifdef PC_HEADER
  44. #include "all.h"
  45. #else
  46. #include "types.h"
  47. #include "quads.h"
  48. #endif
  49.  
  50.  
  51.  
  52. /*
  53.  * At this time there is no quadrilateral optimization.  Just call the
  54.  * triangle function twice.
  55.  * v0, v1, v2, v3 in CCW order = front facing.
  56.  */
  57. static void basic_quad( GLcontext *ctx,
  58.                         GLuint v0, GLuint v1, GLuint v2, GLuint v3, GLuint pv )
  59. {
  60.    (*ctx->Driver.TriangleFunc)( ctx, v0, v1, v3, pv );
  61.    (*ctx->Driver.TriangleFunc)( ctx, v1, v2, v3, pv );
  62. }
  63.  
  64.  
  65.  
  66. /*
  67.  * Draw nothing (NULL raster mode)
  68.  */
  69. static void null_quad( GLcontext *ctx,
  70.                        GLuint v0, GLuint v1, GLuint v2, GLuint v3, GLuint pv )
  71. {
  72.    (void) ctx;
  73.    (void) v0;
  74.    (void) v1;
  75.    (void) v2;
  76.    (void) v3;
  77.    (void) pv;
  78. }
  79.  
  80.  
  81.  
  82. void gl_set_quad_function( GLcontext *ctx )
  83. {
  84.    if (ctx->RenderMode==GL_RENDER) {
  85.       if (ctx->NoRaster) {
  86.          ctx->Driver.QuadFunc = null_quad;
  87.       }
  88.       else if (ctx->Driver.QuadFunc) {
  89.          /* Device driver will draw quads. */
  90.       }
  91.       else {
  92.          ctx->Driver.QuadFunc = basic_quad;
  93.       }
  94.    }
  95.    else {
  96.       /* if in feedback or selection mode we can fall back to triangle code */
  97.       ctx->Driver.QuadFunc = basic_quad;
  98.    }      
  99. }
  100.  
  101.  
  102.